package com.qf.filters;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.stereotype.Component;

@Component
public class MyPreFilter03 extends ZuulFilter {
    @Override
    public String filterType() {

        return FilterConstants.PRE_TYPE;
    }

    @Override
    public int filterOrder() {
        return 3;
    }

    @Override
    public boolean shouldFilter() {
        RequestContext context = RequestContext.getCurrentContext();

        return context.sendZuulResponse();

    }

    @Override
    public Object run() throws ZuulException {

        System.out.println("前置030303");
//        发送mq 消息  把数据带出去 这就是协议转化
//        协议是指定从协议的格式到数据
//        通过http 传递的JSON 数据过来了  我转成了XML 发出去也算协议转化
        return null;
    }
}
